#查看安装了哪些
yum list installed | grep mysql

##删除原来的
yum remove mariadb mariadb-*
yum remove mysql mysql-*
yum remove mysql mysql-libs


#下载
wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar

#解压
tar xvf mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar

#安装
yum localinstall mysql-community-common-5.7.18-1.el6.x86_64.rpm
yum localinstall mysql-community-libs-5.7.18-1.el6.x86_64.rpm
yum localinstall mysql-community-client-5.7.18-1.el6.x86_64.rpm
yum localinstall mysql-community-server-5.7.18-1.el6.x86_64.rpm

#查看版本
mysql -V

#启动
rm -rf /var/lib/mysql
service mysqld start

#重启
service mysqld restart

#停止服务
service mysqld stop

#找到临时密码
grep 'temporary password' /var/log/mysqld.log

#登录(注意用临时密码)
mysql -u root -p

#修改密码
SET PASSWORD = PASSWORD('tywop-0P-0');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'tywop-0P-0' WITH GRANT OPTION;
FLUSH PRIVILEGES;








#先检查是否安装了iptables
service iptables status

#安装iptables
yum install -y iptables

#升级iptables（安装的最新版本则不需要）
yum update iptables 

#安装iptables-services
yum install iptables-services


